const app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    show: {
      type: Boolean,
      default: false 
    },
    money:{
      type:String,
      default:0
    },
    isIphoneX: {
      type: Boolean,
      default: false 
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    
    password: '',
		trantision: false
  },

  /**
   * 组件的方法列表
   */
  methods: {
    key(e) {
      let key=e.currentTarget.dataset.index;
      if (this.data.password.length < 6) {
        this.setData({
          password:this.data.password+key
        })
        if (this.data.password.length == 6) {
          let params={
            money:this.data.money,
            password:this.data.password
          };
          this.triggerEvent("confirm",params);
        }
      }
    },
    clear() {
      this.password = '';
    },
    close() {
      this.setData({
        password:'',
        trantision:false,
        show:false
      })
    },
    del() {
      if (this.data.password.length > 0) {
        this.setData({
          password:this.data.password.substring(0, this.data.password.length - 1)
        })
      }
    }
  }
})
